*Replication Code for “Anachro-Knowledge: Officeholder Change and Outdated Political Knowledge”
*Melissa Burgess and Todd Makse
*August 2025
*All analyses conducted in STATA IC 16.1

use "C:\Anachro Replication Data.dta"
*Figure 1
generate opk1_w = 0
replace opk1_w = 1 if opk1==1
generate opk1_o = 0
replace opk1_o = 1 if opk1==2
generate opk2_w = 0
replace opk2_w = 1 if opk2==1
generate opk2_o = 0
replace opk2_o = 1 if opk2==2
generate opk3_o = 0
replace opk3_o = 1 if opk3==2
generate opk3_w = 0
replace opk3_w = 1 if opk3==1
recode citycode (14=1) (19=9) (28=2) (53=6) (60=3) (67=11) (68=8) (70=7) (80=4) (89=5) (97=10) , generate(cityorder)

graph hbar opk1_w opk1_o, over(citycode, sort(cityorder))
graph hbar opk2_w opk2_o, over(citycode, sort(cityorder))
graph hbar opk3_w opk3_o, over(citycode, sort(cityorder))

*Figure 2
generate age4=0
replace age4=1 if age>29 & age<45
replace age4=2 if age>44 & age<65
replace age4=3 if age>64
xtile media3 = mc_avg, nquantiles(3)

eststo inci: mean incorrect, over(educ4)
eststo inco: mean outdated, over(educ4)
coefplot (inci, offset(0.2)) (inco,offset(-.2))

eststo educi: mean incorrect, over(educ4)
eststo educo: mean outdated, over(educ4)
coefplot (educi, offset(0.2)) (educo,offset(-.2))

eststo agei: mean incorrect, over(age4)
eststo ageo: mean outdated, over(age4)
coefplot (agei, offset(0.2)) (ageo, offset(-.2))

eststo femalei: mean incorrect, over(female)
eststo femaleo: mean outdated, over(female)
coefplot (femalei, offset(0.2)) (femaleo, offset(-.2))

eststo urbani: mean incorrect, over(urban)
eststo urbano: mean outdated, over(urban)
coefplot (urbani, offset(0.2)) (urbano, offset(-.2))

eststo homeowni: mean incorrect, over(homeown)
eststo homeowno: mean outdated, over(homeown)
coefplot (homeowni, offset(0.2)) (homeowno, offset(-.2))

eststo pid3i: mean incorrect, over(pid3a)
eststo pid3o: mean outdated, over(pid3a)
coefplot (pid3i, offset(0.2)) (pid3o, offset(-.2))

eststo ethi: mean incorrect, over(eth)
eststo etho: mean outdated, over(eth)
coefplot (ethi, offset(0.2)) (etho,offset(-.2))

eststo media3i: mean incorrect, over(media3)
eststo media3o: mean outdated, over(media3)
coefplot (media3i, offset(0.2)) (media3o, offset(-.2))

*Figure 3
generate opk_o = 0
replace opk_o=1 if opk_resp==2
generate opk_w= 0
replace opk_w=1 if opk_resp==1
collapse opk_o opk_w tenure opk_obs, by(office_id)

*Use resultant dataset (Anachro Response Averages by Office.dta)
use "C:\Anachro Response Averages by Office.dta"
twoway scatter outdated tenure if level==1 || scatter outdated tenure if level==2 || scatter outdated tenure if level==3 || lfit outdated tenure, ysc(r(0 0.4))
twoway scatter incorrect tenure if level==1 || scatter incorrect tenure if level==2 || scatter incorrect tenure if level==3 || lfit incorrect tenure

*Table 1
use "C:\Anachro Replication Data.dta"
*Local models
mlogit opk_resp tenure age income4 educ4 female urban pid7 ib4.ethnicity homeown mc_avg loc_media if opk_obs==3 [pweight=weight], cl(citycode) b(3)
*Substantive interpretation
margins, at(age=(19 72))
margins, at(educ=(0 3))
margins, at(mc_avg=(0 4.75))
margins, at(loc_media=(-7 7))
margins, at(tenure=(0 4))
*Test for combining categories (remove clustering to do this)
mlogit opk_resp tenure age income4 educ4 female urban pid7 ib4.ethnicity homeown mc_avg loc_media if opk_obs==3 [pweight=weight], b(3)
mlogtest, combine
*Test IIA assumption; note, this requires dropping weights and clustered standard errors and temporarily dropping irrelevant observations
drop if opk_obs!=3
mlogit opk_resp tenure age income4 educ4 female urban pid7 ib4.ethnicity homeown mc_avg loc_media, b(3)
mlogtest, iia
clear 
use "C:\Anachro Replication Data.dta"

*State models 
mlogit opk_resp tenure age income4 educ4 female urban pid7 ib4.ethnicity homeown mc_avg loc_media if opk_obs==2 [pweight=weight], cl(citycode) b(3)
*Substantive interpretation 
margins, at(age=(19 72))
margins, at(educ=(0 3))
margins, at(mc_avg=(0 4.75))
margins, at(tenure=(0 4))
margins, at(homeown=(0 1))
*Test for combining categories (remove clustering to do this)
mlogit opk_resp tenure age income4 educ4 female urban pid7 ib4.ethnicity homeown mc_avg loc_media if opk_obs==2 [pweight=weight], b(3)
mlogtest, combine
*Test IIA assumption; note, this requires dropping weights and clustered standard errors and temporarily dropping irrelevant observations
drop if opk_obs!=2
mlogit opk_resp tenure age income4 educ4 female urban pid7 ib4.ethnicity homeown mc_avg loc_media, b(3)
mlogtest, iia
clear 
use "C:\Anachro Replication Data.dta"

*National models
mlogit opk_resp age income4 educ4 female urban pid7 ib4.ethnicity homeown mc_avg loc_media if opk_obs==1 [pweight=weight], cl(citycode) b(3)
*Substantive interpretation 
margins, at(age=(19 72))
margins, at(educ=(0 3))
margins, at(female=(0 1))
margins, at(homeown=(0 1))
margins, at(mc_avg=(0 4.75))
*Test for combining categories (remove clustering to do this)
mlogit opk_resp age income4 educ4 female urban pid7 ib4.ethnicity homeown mc_avg loc_media if opk_obs==1 [pweight=weight], b(3)
mlogtest, combine
*Test IIA assumption; note, this requires dropping weights and clustered standard errors and temporarily dropping irrelevant observations
drop if opk_obs!=1
mlogit opk_resp tenure age income4 educ4 female urban pid7 ib4.ethnicity homeown mc_avg loc_media, b(3)
mlogtest, iia
clear 
use "C:\Anachro Replication Data.dta"

*Figure 4
*Local level, effect of education 
mlogit opk_resp tenure age educ4 female urban pid7 ib4.ethnicity homeown mc_avg loc_media if opk_obs==3 [pweight=weight], cl(citycode) b(3)
margins, at(educ=(0 1 2 3)) predict(outcome(1)) predict(outcome(2))
marginsplot, noci
*State level, effect of education
mlogit opk_resp tenure age educ4 female urban pid7 ib4.ethnicity homeown mc_avg loc_media if opk_obs==2 [pweight=weight], cl(citycode) b(3)
margins, at(educ=(0 1 2 3)) predict(outcome(1)) predict(outcome(2))
marginsplot, noci
*National level, effect of education
mlogit opk_resp age educ4 female urban pid7 ib4.ethnicity homeown mc_avg loc_media if opk_obs==1 [pweight=weight], cl(citycode) b(3)
margins, at(educ=(0 1 2 3)) predict(outcome(1)) predict(outcome(2))
marginsplot, noci

*Table 2 (pooled models)
mlogit opk_resp c.tenure##i.opk_obs  age income4 educ4 female urban pid7 ib4.ethnicity homeown mc_avg loc_media if inlist(opk_obs,2,3) [pweight=weight], cl(id) b(3)

Appendix

*Table A-1 
use "C:\Anachro City Sample Representativeness.dta"
ttest totpop, by(insurvey)
ttest whitepct, by(insurvey)
ttest blackpct, by(insurvey)
ttest asianpct, by(insurvey)
ttest hisppct, by(insurvey)
ttest femalepct, by(insurvey)
ttest medage, by(insurvey)
ttest baplus, by(insurvey)
ttest medinc, by(insurvey)
ttest marrpct, by(insurvey)

*Table A-2
use "C:\Anachro Replication Data.dta"
sum female i.eth i.age4 i.educ4 if opk_obs==1
sum female i.eth i.age4 i.educ4 if opk_obs==1 [aweight = weight]

*Figure A-1
use "C:\Anachro Within City Sample Representativeness.dta"
graph dot actual survey if citycode==14, over(varnum) leg(off) title("Buffalo")
graph dot actual survey if citycode==19, over(varnum) leg(off) title("Philadelphia")
graph dot actual survey if citycode==28, over(varnum) leg(off) title("Charlotte")
graph dot actual survey if citycode==53, over(varnum) leg(off) title("Milwaukee")
graph dot actual survey if citycode==60, over(varnum) leg(off) title("Chicago")
graph dot actual survey if citycode==67, over(varnum) leg(off) title("Wichita")
graph dot actual survey if citycode==68, over(varnum) leg(off) title("Omaha")
graph dot actual survey if citycode==70, over(varnum) leg(off) title("New Orleans")
graph dot actual survey if citycode==80, over(varnum) leg(off) title("Colorado Springs")
graph dot actual survey if citycode==89, over(varnum) leg(off) title("Las Vegas")
graph dot actual survey if citycode==97, over(varnum) leg(off) title("Portland")

*Table A-4
use "C:\Anachro Replication Data.dta"
sum i.opk_resp tenure age income4 educ4 female urban pid7 ib4.ethnicity homeown loc_media mc_avg if opk_resp!=. [aweight=weight]
tab opk_resp opk_obs [aweight=weight], col

*Table A-5
*Local level
mprobit opk_resp tenure age income4 educ4 female urban pid7 ib4.ethnicity homeown mc_avg loc_media if opk_obs==3 [pweight=weight], cl(citycode) base(3)
*State level
mprobit opk_resp tenure age income4 educ4 female urban pid7 ib4.ethnicity homeown mc_avg loc_media if opk_obs==2 [pweight=weight], cl(citycode) base(3)
*National level
mprobit opk_resp age income4 educ4 female urban pid7 ib4.ethnicity homeown mc_avg loc_media if opk_obs==1 [pweight=weight], cl(citycode) base(3)

*Table A-6 
mlogit opk_resp dur_min tenure i.opk_obs age income4 educ4 female urban pid7 ib4.ethnicity homeown mc_avg loc_media [pweight=weight], cl(id) b(3)

mlogit opk_resp c.dur_min##c.tenure i.opk_obs age income4 educ4 female urban pid7 ib4.ethnicity homeown mc_avg loc_media  [pweight=weight], cl(id) b(3)

*Table A-7
*First column
mlogit opk_resp tenure i.opk_obs age income4 educ4 female urban pid7 ib4.ethnicity homeown mc_avg loc_media ib1.party_align [pweight=weight], cl(id) b(3)
*Second column
mlogit opk_resp tenure i.opk_obs age income4 educ4 female urban pid7 ib4.ethnicity homeown mc_avg loc_media ib1.party_align if party_switched==1 [pweight=weight], cl(id) b(3)

*Table A-8
mlogit opk_resp tenure i.opk_obs age income4 educ4 female urban pid7 ib4.ethnicity homeown mc_avg loc_media official_female [pweight=weight], cl(id) b(3)
margins, at(official_female=(0 1))
